procedure insert( key : typekey; var r : dataarray );
var i, inc, last : integer;
begin
i := hashfunction( key ) ;
inc := increment( key );
last := (i+(m-1)*inc) mod m;
while (i<>last) and (not empty(r[i]))
and (not deleted(r[i])) and (r[i].k<>key) do
i := (i+inc) mod m;
if empty(r[i]) or deleted(r[i]) then
begin
{*** insert here ***}
r[i].k := key;
n := n+1
end
else Error {*** table full, or key already in table ***};
end;
|